package com.example.photography.adapter.community;

import android.content.Context;
import android.net.Uri;
import android.view.View;

import com.example.photography.R;
import com.example.photography.adapter.MyBaseAdapter;
import com.example.photography.bean.UrlBean;
import com.facebook.drawee.view.SimpleDraweeView;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

//约拍图片适配器
public class Item_ComProductAdapter extends MyBaseAdapter {
    public Item_ComProductAdapter(List list, Context context) {
        super(list, context);
    }

    @Override
    public View myGetView(int position, View convertView) {
        ViewHolder viewHolder = null;
        if (convertView == null) {
            convertView = View.inflate(mContext, R.layout.item_appoint_product, null);
            viewHolder = new ViewHolder(convertView);
            convertView.setTag(viewHolder);
        } else {
            viewHolder = (ViewHolder) convertView.getTag();
        }
        UrlBean urlBean = (UrlBean) list.get(position);
        viewHolder.svProduct.setImageURI((Uri.parse(urlBean.getUrl())));
        return convertView;
    }


    static
    class ViewHolder {
        @BindView(R.id.sv_product)
        SimpleDraweeView svProduct;

        ViewHolder(View view) {
            ButterKnife.bind(this, view);
        }
    }
}
